<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<html:html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>
  <bean:message key="F0401.title"/>
  </title>
  <META http-equiv=Pragma content=no-cache>
  <META http-equiv=Cache-Control content=no-cache>
  <META http-equiv=Expires content=0>
  <link rel="stylesheet"
		href="<%=request.getContextPath()%>/resource/css/style.css"
		type="text/css">
  <script language="javascript" type="text/javascript"
		src="<%=request.getContextPath()%>/resource/js/util.js"></script>
  <script language="javascript" type="text/javascript"
		src="<%=request.getContextPath()%>/style/scripts/util.js"></script>
  <script language="javascript" type="text/javascript"
		src="<%=request.getContextPath()%>/resource/js/AdyhUtil.js"></script>
  <script language="javascript" type="text/javascript"
		src="<%=request.getContextPath()%>/resource/js/Validator.js"></script>
  <script language="javascript" type="text/javascript"
		src="<%=request.getContextPath()%>/resource/calendar/DCDA_C03.js"></script>
  <script>
/**保存*/
function ShowAlert()
{	
	ResetMe();
	var unitPrice = Jtrim(document.getElementById("unitPrice").value);
	var qty = Jtrim(document.getElementById("qty").value);
	
	var objPrompt = document.getElementById("divPrompt");
    objPrompt.style.display = "block";
    objPrompt.innerHTML = "";
	
	if(unitPrice.length==0){
		objPrompt.innerHTML += "<li><bean:message key="F0406.price"/><bean:message key="adyh.error.isnull"/>！";
		document.getElementById("unitPrice").className = "MyControlError";
	}else if(isNumber(unitPrice)||parseInt(unitPrice)<0){
		objPrompt.innerHTML += "<li><bean:message key="F0406.price"/><bean:message key="adyh.error"/>！";
		document.getElementById("unitPrice").className = "MyControlError";
	}if(qty.length==0){
		objPrompt.innerHTML += "<li><bean:message key="adyh.quantity"/><bean:message key="adyh.error.isnull"/>！";
		document.getElementById("qty").className = "MyControlError";
	}else if(isNumber(qty)||parseInt(qty)<0){
		objPrompt.innerHTML += "<li><bean:message key="adyh.quantity"/><bean:message key="adyh.error"/>！";
		document.getElementById("qty").className = "MyControlError";
	}else{
		document.getElementById("unitPrice").value = unitPrice;
		document.getElementById("qty").value = qty;
		operation("update");
	}
}

/**重置*/
function ResetMe()
{
    document.getElementById("unitPrice").className = "MyText";
	
	var objPrompt = document.getElementById("divPrompt");
    objPrompt.style.display = "none";
	objPrompt.innerHTML = "";
}
function ShowFormTitle(strTitle)
{
	document.write("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"height:26px; background-position: left bottom; background-image: url(../../resource/image/FormTitle_A_4.gif); background-repeat: repeat-x;\">");
	document.write("  <tr >");
	document.write("	<td style=\"width:5px; background-position: left bottom; background-image: url(../../resource/image/FormTitle_A_1.gif); background-repeat: no-repeat;\">&nbsp;&nbsp;&nbsp;</td>");
	document.write("	<td class=\"FormTitle\" style=\"width:100%; padding-left:5px; padding-top:3px; background-position: left bottom; background-image: url(../../resource/image/FormTitle_A_2.gif); background-repeat: no-repeat;\">");
	document.write("		<span id=\"spanFormTitle\" class=\"SpanTitle\">"+ strTitle +"</span>");
	document.write("	</td>");
	document.write("	<td style=\"width:5px; background-position: right bottom; background-image: url(../../resource/image/FormTitle_A_3.gif); background-repeat: no-repeat;\">&nbsp;&nbsp;&nbsp;</td>");
    document.write("  </tr>");
	document.write("</table>");
}
</script>
  </head>
  <body>
  <html:form method="post" action="/pages/F04/F0401.do">
    <html:hidden property="operationType" />
	<html:hidden property="language"/>
    <html:hidden property="errorFlag" />
    <!--Begin：表单标题-->
    <div class="DivBlock">
      <script language="javascript" type="text/javascript">
		ShowFormTitle("<bean:message key="F0401.title"/>");
	</script>
    </div>
    <!--End：表单标题-->
    <!--Begin：表单主体区块-->
    <div class="DivBlock">
      <div class="DivWrap" style="display:block">
        <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
          <TR>
            <TD ALIGN="right" NOWRAP><!--材料编码-->
              <bean:message key="adyh.materialCode"/>
            </TD>
            <TD colspan="3" ALIGN="left" NOWRAP><html:text property="materialCode" styleClass="MyTextReadOnly" readonly="true"/>
             </TD>
            <TD ALIGN="right" NOWRAP><!--材料名称-->
              <bean:message key="adyh.materialName"/></TD>
            <TD ALIGN="left" NOWRAP><html:text property="materialName" styleClass="MyTextReadOnly" readonly="true"/></TD>
          </TR>
		  <TR>
            <TD ALIGN="right" NOWRAP><!--材料数量-->
              <bean:message key="adyh.quantity"/>
            </TD>
            <TD colspan="3" ALIGN="left" NOWRAP><html:text property="qty" styleClass="MyText" style="text-align:right"/>
             </TD>
            <TD ALIGN="right" NOWRAP><!--材料单价-->
              <bean:message key="F0406.price"/></TD>
            <TD ALIGN="left" NOWRAP><html:text property="unitPrice" styleClass="MyText" style="text-align:right; text-transform:capitalize" onblur="money_format(this)"  maxlength="20"/>
			<span class="Need">*</span></TD>
          </TR>
          <TR>
            <TD ALIGN="right" NOWRAP><!--描述-->
              <bean:message key="adyh.description"/>
            </TD>
            <TD ALIGN="left" NOWRAP colspan="5"><html:textarea property="description" styleClass="MyArea" style="width:430" rows="3"/>
            </TD>
          </TR>
        </TABLE>
      </div>
    </div>
    <!--End：表单主体区块-->
    <!--Begin：表单按钮及提示区-->
    <div class="DivBlock">
      <div class="DivButton">
        <input type="button" name="Submit1" class="MyButton"
					onClick="ShowAlert()"  value="<bean:message key="common.save"/>">
        <input type="button" name="Submit2" class="MyButton" value="<bean:message key="common.back"/>"
        onClick="javascript:operation('detailBack');"> </div>
      <div class="DivPrompt" id="divPrompt" style="display:none"> </div>
    </div>
    <!--End：表单按钮及提示区-->
  </html:form>
  </body>
</html:html>
<script language="javascript" type="text/javascript">
InitForm();
</script>
